package com.bookmarket.test;

import com.bookmarket.entity.Accident;
import com.bookmarket.entity.Admin;
import com.bookmarket.service.IAccidentService;
import com.bookmarket.service.IAdminService;
import com.github.pagehelper.PageHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-mybatis.xml")
public class LoginDemo {
    @Resource
    private IAdminService  adminService;

    @Resource
    private IAccidentService accidentService;

       @Test
        public void test(){
          Admin admin=adminService.login("admin","admin");
           System.out.println(admin);

        }



    @Test
    public void test1() {
        PageHelper.startPage(1, 3);
        List<Accident> list = accidentService.findAll();

        for (Accident a : list) {
            System.out.println(a.getReason());
        }
    }





    public IAdminService getAdminService() {
        return adminService;
    }

    public void setAdminService(IAdminService adminService) {
        this.adminService = adminService;
    }


    public IAccidentService getAccidentService() {
        return accidentService;
    }

    public void setAccidentService(IAccidentService accidentService) {
        this.accidentService = accidentService;
    }
}
